package com.ruoyi.energy.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import cn.hutool.core.util.IdUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.core.utils.SecurityUtils;
import com.ruoyi.energy.mapper.QyOperationStatisticsMapper;
import com.ruoyi.energy.domain.QyOperationStatistics;
import com.ruoyi.energy.service.IQyOperationStatisticsService;

/**
 * 运营统计Service业务层处理
 *
 * @author cjie
 * @date 2021-08-02
 */
@Service
public class QyOperationStatisticsServiceImpl implements IQyOperationStatisticsService {
    @Autowired
    private QyOperationStatisticsMapper qyOperationStatisticsMapper;

    /**
     * 查询运营统计
     *
     * @param id 运营统计ID
     * @return 运营统计
     */
    @Override
    public QyOperationStatistics selectQyOperationStatisticsById(String id) {
        return qyOperationStatisticsMapper.selectQyOperationStatisticsById(id);
    }

    /**
     * 查询运营统计列表
     *
     * @param qyOperationStatistics 运营统计
     * @return 运营统计
     */
    @Override
    public List<QyOperationStatistics> selectQyOperationStatisticsList(QyOperationStatistics qyOperationStatistics) {
        return qyOperationStatisticsMapper.selectQyOperationStatisticsList(qyOperationStatistics);
    }

    /**
     * 新增运营统计
     *
     * @param qyOperationStatistics 运营统计
     * @return 结果
     */
    @Override
    public int insertQyOperationStatistics(QyOperationStatistics qyOperationStatistics) {
        qyOperationStatistics.setId(IdUtil.getSnowflake(0, 0).nextIdStr());
        qyOperationStatistics.setCreateTime(DateUtils.getNowDate());
        qyOperationStatistics.setCreateBy(SecurityUtils.getUsername());
        return qyOperationStatisticsMapper.insertQyOperationStatistics(qyOperationStatistics);
    }

    /**
     * 修改运营统计
     *
     * @param qyOperationStatistics 运营统计
     * @return 结果
     */
    @Override
    public int updateQyOperationStatistics(QyOperationStatistics qyOperationStatistics) {
        qyOperationStatistics.setUpdateTime(DateUtils.getNowDate());
        qyOperationStatistics.setUpdateBy(SecurityUtils.getUsername());
        return qyOperationStatisticsMapper.updateQyOperationStatistics(qyOperationStatistics);
    }

    /**
     * 批量删除运营统计
     *
     * @param ids 需要删除的运营统计ID
     * @return 结果
     */
    @Override
    public int deleteQyOperationStatisticsByIds(String[] ids) {
        return qyOperationStatisticsMapper.deleteQyOperationStatisticsByIds(ids);
    }

    /**
     * 删除运营统计信息
     *
     * @param id 运营统计ID
     * @return 结果
     */
    @Override
    public int deleteQyOperationStatisticsById(String id) {
        return qyOperationStatisticsMapper.deleteQyOperationStatisticsById(id);
    }
}
